import * as echarts from '../ec-canvas/echarts.min.js';
function initChart(canvas, width, height) {
  const chart = echarts.init(canvas, null, {
    width: width,
    height: height
  });
  canvas.setChart(chart);

  var option = {
    title: {
      text: '系统老师/学生数',
      left:'10',
      top:"5"
    },
    legend:{
      show:true,
      type:"plain",
      orient:"vertical",
      right:"0",
      top:"30"
    },
    toolbox: {
      show: true,
      feature: {
        dataZoom: {
          yAxisIndex: 'none'
        },
        dataView: { readOnly: false },
        magicType: { type: ['line', 'bar'] },
        restore: {},
        saveAsImage: {}
      }
    },
    xAxis: {
      type: 'category',
      data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
    },
    yAxis: {
      type: 'value'
    },
    series: [{
      data: [120, 200, 150, 80, 70, 110, 130],
      name:"stu",
      type: 'line',
      label: {
        show: true, // 显示标签
        position: 'top' // 标签位置，可以是 'top'、'bottom'、'left'、'right' 等
      }
    },
    {
      data: [69, 84, 111, 99, 70, 75, 170],
      type: 'line',
      name:"tea",
      label: {
        show: true, // 显示标签
        position: 'top' // 标签位置，可以是 'top'、'bottom'、'left'、'right' 等
      }
    }]
  };
  chart.setOption(option);
  return chart;
}
function initChart1(canvas, width, height) {
  const chart = echarts.init(canvas, null, {
    width: width,
    height: height
  });
  canvas.setChart(chart);

  var option = {
    title: {
      text: '公告数/公告总数',
      left:'10',
      top:"5"
    },
    legend:{
      show:true,
      type:"plain",
      right:"0",
      bottom:"0"
    },
    toolbox: {
      show: true,
      feature: {
        dataZoom: {
          yAxisIndex: 'none'
        },
        dataView: { readOnly: false },
        magicType: { type: ['line', 'bar'] },
        restore: {},
        saveAsImage: {}
      }
    },
    xAxis:[
      {
        type: 'category',
        data: ['九月一号',"九月二号","九月三号","九月四号","九月五号"]
      },
      {
        type: 'category',
        data: ['九月一号',"九月二号","九月三号","九月四号","九月五号"],
        show:false
      }
    ],
    yAxis:[
      {
        type: 'value',
        scale: true,
        boundaryGap: [0.2, 0.2]
      },
      {
        type: 'value',
        scale: true,
        boundaryGap: [0.2, 0.2]
      }
    ],
    series: [{
      data: [120, 200, 150, 80, 70],
      name:"公告数",
      xAxisIndex: 1,
      yAxisIndex: 1,
      type: 'line',
      label: {
        show: true, // 显示标签
        position: 'top' // 标签位置，可以是 'top'、'bottom'、'left'、'right' 等
      }
    },
    {
      data: [69, 84, 111, 99, 70 ],
      type: 'bar',
      name:"公告总数",
      label: {
        show: true, // 显示标签
        position: 'inside' //  标签位置，可以是 'top'、'bottom'、'inside' 等
      }
    }]
  };
  chart.setOption(option);
  return chart;
}
function initChart2(canvas, width, height) {
  const chart = echarts.init(canvas, null, {
    width: width,
    height: height
  });
  canvas.setChart(chart);

  var option = {
    title: {
      text: '班级数/班级总数',
      left:'10',
      top:"5"
    },
    legend:{
      show:true,
      type:"plain",
      right:"0",
      bottom:"0"
    },
    toolbox: {
      show: true,
      feature: {
        dataZoom: {
          yAxisIndex: 'none'
        },
        dataView: { readOnly: false },
        magicType: { type: ['line', 'bar'] },
        restore: {},
        saveAsImage: {}
      }
    },
    xAxis:[
      {
        type: 'category',
        data: ['九月一号',"九月二号","九月三号","九月四号","九月五号"]
      },
      {
        type: 'category',
        data: ['九月一号',"九月二号","九月三号","九月四号","九月五号"],
        show:false
      }
    ],
    yAxis:[
      {
        type: 'value',
        scale: true,
        boundaryGap: [0.2, 0.2]
      },
      {
        type: 'value',
        scale: true,
        boundaryGap: [0.2, 0.2]
      }
    ],
    series: [{
      data: [120, 200, 150, 80, 70],
      name:"班级数",
      xAxisIndex: 1,
      yAxisIndex: 1,
      type: 'line',
      label: {
        show: true, // 显示标签
        position: 'top' // 标签位置，可以是 'top'、'bottom'、'left'、'right' 等
      }
    },
    {
      data: [69, 84, 111, 99, 70 ],
      type: 'bar',
      name:"班级总数",
      label: {
        show: true, // 显示标签
        position: 'inside' //  标签位置，可以是 'top'、'bottom'、'inside' 等
      }
    }]
  };
  chart.setOption(option);
  return chart;
}
export {initChart,initChart1,initChart2}